from celery import Celery
import os
from django.conf import settings


# 配置环境变量
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Delivery_project.settings")

# 创建celery应用
app = Celery("worker")

# 配置app
app.conf.broker_url = 'redis://:123@127.0.0.1:6379/5'
app.conf.result_backend = 'redis://:123@127.0.0.1:6379/6'


# 自动发现任务函数
app.autodiscover_tasks(settings.INSTALLED_APPS)


# celery -A Delivery_project worker -l info -P eventlet